import Joi from '@hapi/joi';
import {paginateRule} from '../common';

export const indexRule = {
    query: {
        keyword: Joi.string().trim().allow(''),
        id: Joi.string().trim(),
        ...paginateRule,
    },
};


export const createRule = {
    body: {
        keyword: Joi.string()
            .trim()
            .required(),
        is_hot: Joi.number()
            .required(),
        is_show: Joi.number()
            .allow(''),
        sort_order: Joi.number()
            .required(),
    },
};

export const updateRule = {
    params: {
        id: Joi.string(),
    },
    body: createRule.body
};

export const destroyRule = {
    params: {
        id: Joi.string(),
    },
};

